% 
% @(#)Boolean.m	1.2  6/29/87
%
export _BooleanObject to "Builtins"

const _BooleanObject == immutable object _BooleanObject
  export getSignature, makeTrue, makeFalse
  
  const BooleanType == immutable type BooleanType
    function > [o : Boolean] -> [r : Boolean]
    function >=[o : Boolean] -> [r : Boolean]
    function < [o : Boolean] -> [r : Boolean]
    function <=[o : Boolean] -> [r : Boolean]
    function = [o : Boolean] -> [r : Boolean]
    function !=[o : Boolean] -> [r : Boolean]
    function & [o : Boolean] -> [r : Boolean]
    function | [o : Boolean] -> [r : Boolean]
    function ! -> [r : Boolean]
    function asString -> [s : String]
      % s <- either "true" or "false"
  end BooleanType
  function getSignature -> [result : Signature]
    result <- BooleanType
  end getSignature
  function create [data : Integer] -> [result : BooleanType]
    result <- immutable object aBoolean
      export >, >=, <, <=, =, !=, &, |, !, asString

      function > [o : Boolean] -> [r : Boolean]
	primitive 003 [r] <- [o]
      end >
      function >= [o : Boolean] -> [r : Boolean]
	primitive 103 [r] <- [o]
      end >=
      function < [o : Boolean] -> [r : Boolean]
	primitive 203 [r] <- [o]
      end <
      function <= [o : Boolean] -> [r : Boolean]
	primitive 303 [r] <- [o]
      end <=
      function = [o : Boolean] -> [r : Boolean]
	primitive 403 [r] <- [o]
      end =
      function != [o : Boolean] -> [r : Boolean]
	primitive 503 [r] <- [o]
      end !=
      function & [o : Boolean] -> [r : Boolean]
	primitive 603 [r] <- [o]
      end &
      function | [o : Boolean] -> [r : Boolean]
	primitive 703 [r] <- [o]
      end |
      function ! -> [r : Boolean]
	primitive 803 [r] <- []
      end !
      function asString -> [r : String]
	primitive 903 [r] <- []
      end asString
    end aBoolean
  end create
  function makeTrue -> [result : BooleanType]
    result <- true
  end makeTrue
  function makeFalse -> [result : BooleanType]
    result <- false
  end makeFalse
end _BooleanObject
